/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.stop.risk.base.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.stop.common.constant.enums.ParkStopModDictEnum;
import com.hopes.bizz.stop.common.constant.enums.ParkStopSysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 监控点监控因子
 *
 * @author pig
 * @date 2024-02-21 11:08:27
 */
@Data
@TableName("line_poll_monitor_factor")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "监控点监控因子")
public class LinePollMonitorFactorEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


    /**
     * id
     */
    @Schema(description = "id")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 监控点
     */
    @Schema(description = "监控点")
    private Long monitorSiteId;

    /**
     * 监控因子
     */
    @Schema(description = "监控因子")
    private Long factorId;

    /**
     * 因子编码
     */
    @Schema(description = "因子编码")
    private String factorCode;

    /**
     * 所属监测设备
     */
    @Schema(description = "所属监测设备")
    private Long equipmentId;

    /**
     * 是否启用
     */
    @Schema(description = "是否启用")
    private Boolean isUse;

    /**
     * 超标是否报警 1.是 0. 否
     */
    @Schema(description = "超标是否报警 1.是 0. 否")
    private Boolean isAlarm;

    /**
     * 最大报警值
     */
    @Schema(description = "最大报警值")
    private BigDecimal maxAlarm;

    /**
     * 最小报警值
     */
    @Schema(description = "最小报警值")
    private BigDecimal minAlarm;

    /**
     * 是否有量程
     */
    @Schema(description = "是否有量程")
    private Boolean isHaveRange;

    /**
     * 量程最大值
     */
    @Schema(description = "量程最大值")
    private BigDecimal maxRange;

    /**
     * 量程最小值
     */
    @Schema(description = "量程最小值")
    private BigDecimal minRange;

    /**
     * 计量单位
     */
    @Schema(description = "计量单位")
    private Long unitId;

    /**
     * 统计单位
     */
    @Schema(description = "统计单位")
    private Long statisticUnitId;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remarks;

    /**
     * 机构Id
     */
    @Schema(description = "机构Id")
    private Long orgId;


    public String getIsUseStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.isUse);
    }

    public String getIsAlarmStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.isAlarm);
    }

    public String getIsHaveRangeStr() {
        return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.isHaveRange);
    }

    public String getFactorIdStr() {
        return DictResolver.getItemLabelByValue(ParkStopModDictEnum.factor_info, this.factorId);
    }

    public String getUnitIdStr() {
        return DictResolver.getItemLabelByValue(ParkStopSysDictEnum.measure_unit, this.unitId);
    }

}
